//
//  Extension.swift
//  HZJTab
//
//  Created by HZJ on 2017/4/7.
//  Copyright © 2017年 HZJ. All rights reserved.
//

import UIKit

extension UIColor {
    ///随机色
    class func randomColor() -> UIColor{
        return UIColor(red: CGFloat(arc4random_uniform(255))/255.0, green: CGFloat(arc4random_uniform(255))/255.0, blue: CGFloat(arc4random_uniform(255))/255.0, alpha: 1.0)
        
    }
}
extension NSObject {
    func Localized(_ key:String) ->String {
        let lan = UserDefaults.standard.object(forKey: "appLanguage") as! String
        let path = Bundle.main.path(forResource: lan, ofType: "lproj")
        let bundle = Bundle(path: path!)
        return (bundle?.localizedString(forKey: key, value: nil, table: "Localizable"))!
        //        return (NSBundle(path:  NSBundle.mainBundle().pathForResource(String(format: "%@",  NSUserDefaults.standardUserDefaults().objectForKey("appLanguage") as! String), ofType:"lproj")!)?.localizedStringForKey(key, value: nil, table: "LocalizedStrings"))!
    }
    
}
